<?php

class Default_ThumbController extends Zend_Controller_Action
{	
	public function init()
	{
		require_once APPLICATION_PATH . '/../library/PHPThumb/ThumbLib.inc.php';
	}

	public function indexAction()
	{
		$image = urldecode($this->getRequest()->getParam('path'));
		//$image='http://localhost/Wroom/public/images/pilote/default.png';
		$op=@fopen($image,'r');
		if(!$op)
		{
			$image=$this->view->serverUrl().$this->view->baseUrl().'/images/missing.png';
		}
		@fclose($op);
		$thumb = PhpThumbFactory::create($image);
        $thumb->adaptiveResize($this->getRequest()->getParam('width'), $this->getRequest()->getParam('height'));
        $thumb->show();
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender();
	}
}

